 #ifndef GLWIDGET_H
#define GLWIDGET_H

#include <QtGui>
#include <QtOpenGL>
#include <QGLWidget>
#include <math.h>

#include "TrackBallCamera.h"

 class GLWidget : public QGLWidget
 {
     Q_OBJECT

 public:
     GLWidget(QWidget *parent = 0);
     ~GLWidget();
	 void paintGL();

     QSize minimumSizeHint() const;
     QSize sizeHint() const;

 public slots:
     void setXRotation(int angle);
     void setYRotation(int angle);
     void setZRotation(int angle);

 signals:
     void xRotationChanged(int angle);
     void yRotationChanged(int angle);
     void zRotationChanged(int angle);

 protected:
     void initializeGL();
     void resizeGL(int width, int height);
     void mousePressEvent(QMouseEvent *event);
     void mouseMoveEvent(QMouseEvent *event);
	 void keyPressEvent(QKeyEvent*);
	 void wheelEvent(QWheelEvent *event);

 protected:
     void normalizeAngle(int *angle);

     GLuint object;
     int xRot;
     int yRot;
     int zRot;

	 TrackBallCamera * camera;

     QPoint lastPos;
     QColor trolltechGreen;
     QColor trolltechPurple;
 };

 #endif